﻿using System.Web.Mvc;
using SinBiota.Model.Business.MapServices.Interfaces;
using Sinbiota.Web.Models;

namespace Sinbiota.Web.Controllers
{
    public class MapController : BaseController
    {
        // GET: /Map/

        public ActionResult Ajax(string cacheKey)
        {
            ViewData["PagedListGuid"] = cacheKey;

            // This xml file was obtained from the GeoServer server and saved in the path below; 
            // example geoserver url: http://localhost:8080/geoserver/gwc/service/wmts?REQUEST=getcapabilities
            var geoServerCapabilities = GeoServerCapabilities.FromXmlFile(Server.MapPath("~/Resources/wmts.php"));

            return View("AjaxFull", geoServerCapabilities);
        }

        public ActionResult MapJavascript()
        {
            var geoServerCapabilities = GeoServerCapabilities.FromXmlFile(Server.MapPath("~/Resources/wmts.php"));
            ViewData["ServerURL"] = geoServerCapabilities.Url + "gwc/service/ve";
            return PartialView("AjaxFullJavascript");
        }

    }
}
